package com.hdax.dm.controller;

import com.hdax.dm.dto.CommonResponse;
import com.hdax.dm.dto.DtoUtil;
import com.hdax.dm.dto.item.*;
import com.hdax.dm.entity.base.DmImage;
import com.hdax.dm.feign.item.DmItemFeign;
import com.hdax.dm.service.DmItemService;
import com.hdax.dm.service.DmItemTypeService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = "/item")
public class IndexNavController {

    @Resource
    private DmItemTypeService dmItemTypeService;
    @Resource
    private DmItemService dmItemService;

    //查询分类信息
    @RequestMapping(path = "/index/nav")
    public CommonResponse<List<IndexNavTypeDto>> nav(){
        return dmItemTypeService.nav();
    }

    //查询今日推荐
    @RequestMapping(path = "/index/recommend")
    public CommonResponse<List<HotItemDto>> recommend(){
        return dmItemService.recommend();
    }

    //查询即将开售
    @RequestMapping(path = "/index/sell")
    public CommonResponse<List<HotItemDto>> sell(){
        return dmItemService.sell();
    }

    //查询即将开售
    @RequestMapping(path = "/index/floor")
    public CommonResponse<List<FloorDto>> floor(){
        return dmItemService.floor();
    }

    //查询横向导航
    @RequestMapping(path = "/index/lineNav")
    public CommonResponse<List<LineNavDto>> lineNav(){
        return dmItemTypeService.lineNav();
    }

    @RequestMapping(path = "/index/carousel")
    public CommonResponse<List<DmImage>> carousel(){
        return DtoUtil.returnSuccess(dmItemService.carousel());
    }

    //楼层热门演出排行
    @RequestMapping(path = "/index/seniority")
    public CommonResponse<List<FloorItemDto>> seniority(@RequestBody Map<String,Long> params){
        return dmItemService.seniority(params.get("itemTypeId"));
    }
}
